package com.example.demo.dao;

import com.example.demo.model.Job;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @Description 描述
 * @Date 2021-01-13 4:45 下午
 * @Author wuyanshen
 */
@Mapper
public interface JobDao {

    @Select("select * from sys_job")
    List<Job> all();

    @Insert("insert into sys_job (job_name,description,cron,bean_class,method_name,status) values (#{jobName},#{description},#{cron},#{beanClass},#{methodName},#{status})")
    void add(Job job);

    @Update("update sys_job set job_name = #{jobName} ,description = #{description},cron = #{cron},bean_class = #{beanClass},method_name = #{methodName},status = #{status} where id = #{id}")
    void update(Job job);

    @Delete("delete from sys_job where id = #{id}")
    void delete(Integer id);

    @Select("select * from sys_job where job_name = #{jobName}")
    Job getByName(String jobName);
}
